1. Field of the Invention
The present invention relates to a data stream generation apparatus and a method of same, a variable length coded data stream generation apparatus and a method of same, and a camera system.
2. Description of the Related Art
There are various systems for encoding image data, audio data, and so on. The JPEG (Joint Photographic Experts Group) system is a typical such system widely used when encoding still images.
In this JPEG system, various control codes called xe2x80x9cmarkersxe2x80x9d are used to define the structure of the compressed and coded bit stream.
For example, in the DCT system adopted in the JPEG system, although the DC component of a DCT coefficient is expressed by a differential value with one previous block using the correlation between blocks in order to reduce the amount of information, if an error occurs in the data for some reason when transmitting the JPEG compressed and coded data, a large influence is given to the following blocks.
To prevent this, a marker called a xe2x80x9crestart markerxe2x80x9d (RSTm) for clearing the held DC component value is inserted in the bit stream of the JPEG image data for every unit called a xe2x80x9cminimum coded unitxe2x80x9d (MCU) comprised of a set of 8xc3x978 pixel blocks.
Further, there are a start-of-image (SOI) marker indicating the start of an image, an end-of-image (EOI) marker indicating the end of an image, etc.
Each of these markers include a 1-byte header expressed by FFh (xe2x80x9chxe2x80x9d indicates a hexadecimal notation).
For example, the codes FFD0H to FFD7H are assigned to the RSTm, the code FFD8H is assigned to the SOI marker, and the code FFD9h is assigned to the EOI marker.
This header enables the markers to be discriminated from the compressed and coded bit stream.
However, there is some possibility of a code matching with FFh appearing in the compressed and coded data at the time of entropy coding. Therefore, in the encoding apparatus, a byte 00h (hereinafter called a xe2x80x9cbyte stuffxe2x80x9d) is added to the data FFh to distinguish it from a marker.
Summarizing the problems in the present invention, when generating a compressed and coded stream of image data by the JPEG system, it is necessary to insert various markers, byte stuffs, and adjustment bits called xe2x80x9cfill-bitsxe2x80x9d for suitably arranging the markers at the boundaries of the bytes into the compressed and coded bit stream. Such processing requires complex control and requires a register or FIFO memory or other memory of a considerable capacity.
Therefore, such a circuit for generating a data stream has the disadvantage of a complex configuration and large scale. This disadvantage becomes more serious for example when such a circuit is to be designed on an LSI. Improvement is therefore required.
An object of the present invention is to provide a data stream generation apparatus and a method of the same for generating a string of fixed length data of a predetermined bit length from a string of variable length data by a smaller scale circuit and simpler configuration and control by efficiently inserting the byte stuff and performing other processing.
Another object of the present invention is to provide a variable length coded data stream generation apparatus and a method of same for coding desired data by variable length coding to efficiently generate a predetermined data stream by a smaller scale circuit and simpler configuration and control by efficiently inserting the byte stuff and performing other processing.
Still another object of the present invention is to provide a camera system for photographing a desired image and coding the photographed image data by variable length coding which can code the photographed image data by variable length coding to efficiently generate an image data stream especially by a smaller scale circuit and simpler configuration and control.
According to a first aspect of the present invention, there is provided a data stream generation apparatus for generating a data stream including variable length data and predetermined control data, comprising a control data inserting means for inserting control data including first data having a predetermined first data pattern at a desired position in a string of variable length data, a first data combining means for successively combining the variable length data and the inserted control data, a fixed length data extracting means for successively extracting predetermined fixed length data from the combined data, a data pattern detecting means for detecting first data having the first data pattern other than the first data included in the control data from the extracted fixed length data, and output data selecting means for successively selecting output data from the fixed length data and, when first data other than the first data included in the control data is detected, selecting second data having a predetermined second data pattern immediately after the detected first data as the output data.
According to a second aspect of the present invention, there is provided a data stream generation method for generating a data stream including variable length data and predetermined control data comprising the steps of inserting control data including first data having a predetermined first data pattern at a desired position in a string of variable length data, successively combining the variable length data and the inserted control data, successively extracting predetermined fixed length data from the combined data, detecting first data having the first data pattern other than the first data included in the control data from the extracted fixed length data, successively selecting output data from the fixed length data and, when first data other than the first data included in the control data is detected, selecting second data having a predetermined second data pattern immediately after the detected first data as the output data, and successively outputting the output data with a fixed length.
According to a third aspect of the present invention, there is provided a variable length coded data stream generation apparatus for generating a data stream including variable length coded data and predetermined control data comprising a variable length coding means for coding desired data by variable length coding, a control data inserting means for inserting control data including first data having a predetermined first data pattern at a desired position in a string of variable length coded data, a first data combining means for successively combining the variable length coded data and the inserted control data, a fixed length data extracting means for successively extracting predetermined fixed length data from the combined data, a data pattern detecting means for detecting first data having the first data pattern other than the first data included in the control data from the extracted fixed length data, and an output data selecting means for successively selecting output data from the fixed length data, and, when first data other than the first data included in the control data is detected, selecting second data having a predetermined second data pattern immediately after the detected first data as the output data.
According to a fourth aspect of the present invention, there is provided a variable length coded data stream generation method for generating a data stream including variable length coded data and predetermined control data comprising the steps of coding desired data by variable length coding, inserting control data including first data having a predetermined first data pattern at a desired position in a string of variable length coded data, successively combining the variable length coded data and the inserted control data, successively extracting predetermined fixed length data from the combined data, detecting first data having the first data pattern other than the first data included in the control data from the extracted fixed length data, and successively selecting output data from the fixed length data and, when first data other than the first data included in the control data is detected, selecting second data having a predetermined second data pattern immediately after the detected first data as the output data, and successively outputting the selected output data.
According to a fifth aspect of the present invention, there is provided a camera system comprising a photographing means for photographing a desired image to generate image data, a variable length coding means for coding the generated image data by variable length coding, a control data inserting means for inserting control data including first data having a predetermined first data pattern at a desired position in a string of variable length coded image data, a first data combining means for successively combining the variable length coded image data and the inserted control data, a fixed length data extracting means for successively extracting predetermined fixed length coded image data from the combined data, a data pattern detecting means for detecting first data having the first data pattern other than the first data included in the control data from the extracted fixed length coded image data, an output image data selecting means for successively selecting output image data from the fixed length coded image data and, when first data other than the first data included in the control data is detected, selecting second data having a predetermined second data pattern immediately after the detected first data as the output image data, and a processing means for carrying out predetermined processing on a string of the selected output image data.